package com.common.utils.cipher;

import android.util.Base64;

public class BASE64 {

    private final static BASE64 instance = new BASE64();

    /**
     * 单例对象实例
     */
    public static BASE64 getInstance(){
        return instance;
    }

    public byte[] encode(byte[] plain) {
        return Base64.encode(plain, Base64.DEFAULT);
    }

    public String encodeToString(byte[] plain) {
        return Base64.encodeToString(plain, Base64.DEFAULT);
    }

    public byte[] decode(String text) {
        return Base64.decode(text, Base64.DEFAULT);
    }

    public byte[] decode(byte[] text) {
        return Base64.decode(text, Base64.DEFAULT);
    }

}
